/**
 * @param {number[]} nums
 * @return {number[]}
 * 输入：nums = [4,3,2,7,8,2,3,1]
输出：[2,3]
 */
var findDuplicates = function (nums) {
  const map = []
  const res = []
  nums.forEach((item) => {
    map.includes(item) ? res.push(item) : map.push(item)
  })
  return res
}
